package com.xwj.dto;

import org.apache.commons.lang3.StringUtils;

import java.beans.Transient;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by xuweijie on 2018/1/21.
 */
public class CloudHouseInfoDto implements Serializable {
    private static final long serialVersionUID = 8208807557439966661L;
    private int cloudId;
    private String name;
    private String address;
    private String beginDate;
    private String endDate;
    private BigDecimal minLon;
    private BigDecimal maxLon;
    private BigDecimal minLat;
    private BigDecimal maxLat;
    private int status;

    public CloudHouseInfoDto() {
    }

    public int getCloudId() {
        return cloudId;
    }

    public void setCloudId(int cloudId) {
        this.cloudId = cloudId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public BigDecimal getMinLon() {
        return minLon;
    }

    public void setMinLon(BigDecimal minLon) {
        this.minLon = minLon;
    }

    public BigDecimal getMaxLon() {
        return maxLon;
    }

    public void setMaxLon(BigDecimal maxLon) {
        this.maxLon = maxLon;
    }

    public BigDecimal getMinLat() {
        return minLat;
    }

    public void setMinLat(BigDecimal minLat) {
        this.minLat = minLat;
    }

    public BigDecimal getMaxLat() {
        return maxLat;
    }

    public void setMaxLat(BigDecimal maxLat) {
        this.maxLat = maxLat;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(String beginDate) {
        this.beginDate = beginDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    @Transient
    public void setCreateTimeScope(String createTimeScope) {
        if (StringUtils.isBlank(createTimeScope))
            return;
        String[] str = createTimeScope.split(" - ");
        beginDate = str[0];
        endDate = str[1];
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        if (cloudId != 0)
            builder.append(cloudId);
        if (StringUtils.isNotBlank(name))
            builder.append(name);
        if (StringUtils.isNotBlank(address))
            builder.append(address);
        if (minLon != null)
            builder.append(minLon);
        if (maxLon != null)
            builder.append(maxLon);
        if (minLat != null)
            builder.append(minLat);
        if (maxLat != null)
            builder.append(maxLat);
        if (StringUtils.isNotBlank(beginDate))
            builder.append(beginDate);
        if (StringUtils.isNotBlank(endDate))
            builder.append(endDate);
        builder.append(status);
        return builder.toString();
    }
}
